import { createApp } from "vue";
import App from "./App.vue";
import microApp from "@micro-zoe/micro-app";
import router from "./router";
import config from "./config";

const isWatchStart = true
microApp.start(isWatchStart && {
  "disable-memory-router": true,
  'disable-patch-request': true, // 关闭对子应用请求的拦截
  inline: false, // 默认值false
  destroy: false, // 默认值false
  shadowDOM: false, // 默认值false
  ssr: false, // 默认值false
  'router-mode': 'pure', // 所有子应用都设置为state模式
  'disable-scopecss': false, // 默认值false
  'disable-sandbox': false, // 默认值false
  'keep-router-state': true, // 默认值false
  lifeCycles: {
    created(e, appName) {
      console.log(`子应用${appName}被创建`);
    },
    beforemount(e, appName) {
      console.log(`子应用${appName}即将渲染`);
    },
    mounted(e, appName) {
      console.log(`子应用${appName}已经渲染完成`);
    },
    unmount(e, appName) {
      console.log(`子应用${appName}已经卸载`);
    },
    error(e, appName) {
      console.log(`子应用${appName}加载出错`);
    },
  },
});

// microApp.preFetch([
//   {
//     name: 'childHome',
//     iframe: true,
//     url: `${config.app2}/base/demo/`,
//     level: 2
//   }
// ])

const app = createApp(App);
app.use(router).mount("#app");
